#CC	= g++
CC	= gcc
LDFLAGS = -lm -lnetpbm
CFLAGS	= -Wall  -O2 -g 
CVCFLAGS =`pkg-config opencv --cflags`
CVLDFLAGS=`pkg-config opencv --libs`

all: map show_map

show_map:
	make -C ../show_map

map:	map.o fisheye.o fisheye.h sad.o sad.h sharedmem.o image.o
	$(CC) $(CFLAGS) $(LDFLAGS) $(CVLDFLAGS) -o map map.o fisheye.o sad.o sharedmem.o image.o

image.o : image.c image.h
	$(CC) $(CFLAGS) -c image.c -o image.o

fisheye.o : fisheye.c fisheye.h
	$(CC) $(CFLAGS) -c fisheye.c -o fisheye.o

sad.o : sad.c sad.h
	$(CC) $(CFLAGS) -c sad.c -o sad.o

map.o : map.c
	$(CC) $(CFLAGS) $(CVCFLAGS) -c map.c -o map.o

sharedmem.o : ../Common/sharedmem.c
	$(CC) $(CFLAGS) -c ../Common/sharedmem.c -o sharedmem.o

clean:
	rm -f *.o *~ map sample 
	make -C ../show_map clean
